<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<!DOCTYPE html>
<html>
	<head>
		<title>中奖管理</title>
		<meta name="decorator" content="default"/>
		<script type="text/javascript">     
			$(function(){ 
				var defHeight = 300,wh=$(window).height();
				var lh=$('.location').height(),fh=$('#floatHead').height(),sh=$('.det-list').height(),ph=$('.pagelist').height();
				defHeight = (wh-lh-fh-sh-ph-130);
				$('.flexgrid').flexigrid({striped:true,height:defHeight});
			});
			
			function page(n,s){
				$("#pageNo").val(n);
				$("#pageSize").val(s);
				$("#searchForm").submit();
	        	return false;
	        }
	        
	        function deleteAll(){
				var ids =[];//定义一个数组    
	            $('input[name="checkall"]:checked').each(function(){    
	                ids.push($.trim($(this).val()));
	            });
	            document.location.href='${ctx}/sd/winner/delete?ids='+ids;
			}
		</script>
	</head>
	<body>
		<sys:message content="${message}"/>
		<!--导航栏-->
		<div class="location">
			<a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
			<a href="${ctx}/center" class="home"><i></i>
			<span>首页</span></a> 
			<i class="arrow"></i> 
			<span>中奖管理</span>
		</div>
		<!--/导航栏-->

		<!--工具栏-->
		<div id="floatHead" class="toolbar-wrap">
			<div class="toolbar">
				<div class="box-wrap">
					<a class="menu-btn"></a>
					<div class="l-list">
						<ul class="icon-list">
							<li><a class="all" href="javascript:;" onclick="checkAll(this);"><i></i><span>全选</span></a></li>
							<shiro:hasPermission name="sd:winner:add">
								<li><a class="add" href="${ctx}/sd/winner/form"><i></i><span>新增</span></a></li>
							</shiro:hasPermission>
							<shiro:hasPermission name="sd:winner:delete">
								<li><a id="btnDelete" class="del" href="${ctx}/sd/winner/delete?id=${winner.id}" onclick="return confirma('确认要删除该中奖吗？', deleteAll)"><i></i><span>删除</span></a></li>
							</shiro:hasPermission>
							<li><a id="btnDelete" class="del" href="${ctx}/sd/winner/export" ><i></i><span>导出</span></a></li>
						</ul>
					</div>
					<div class="r-list" style="display:none;">
						<input name="txtKeywords" type="text" id="txtKeywords" class="keyword" /> 
						<a id="lbtnSearch" class="btn-search" href="javascript:void(0)">查询</a>
					</div>
				</div>
			</div>
		</div>
		<!--/工具栏-->
		
		<!--搜索栏-->
		<form:form id="searchForm" modelAttribute="winner" action="${ctx}/sd/winner" method="post">
			<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
			<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
			<div class="det-list clearfix">
			    <div class="group btm">
			        <div class="control">
			        <div class="title">是否中奖</div>
					<div class="rule-multi-radio">				
						<form:radiobutton path="isAward"   label="全部"   value="2"   checked="checked" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请选择是否中奖" errormsg="请选择是否中奖" sucmsg=" "/>
					    <form:radiobutton path="isAward"   label="是"   value="1"    htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请选择是否中奖" errormsg="请选择是否中奖" sucmsg=" "/>
					    <form:radiobutton path="isAward"   label="否"   value="0" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请选择是否中奖" errormsg="请选择是否中奖" sucmsg=" "/>
					</div>	
					</div>
					<div class="rule-single-select single-select" >
							<form:select id="selectOption" onchange="change()" path="isLimit" errormsg="请输入选择节点" sucmsg=" ">
									<form:option value="2"  label="全部"></form:option>
								   <form:option value="1"  label="注册过期"></form:option>
								   <form:option value="0"  label="未过期"></form:option>
							</form:select>
			        </div>											    
					<div class="control">
			            <div class="title">奖品名称</div>
			            <form:input path="awardname" htmlEscape="false" cssClass="input normal"/>
			        </div>
					<div class="control">
			            <div class="title">会员昵称</div>
			            <form:input path="nickname" htmlEscape="false" cssClass="input normal"/>
			        </div>	
					<div class="control">
			            <div class="title">微信昵称</div>
			            <form:input path="wechatName" htmlEscape="false" cssClass="input normal"/>
			        </div>				        		        
					<div class="control">
			            <div class="title">openid</div>
			            <form:input path="openid" htmlEscape="false" cssClass="input normal"/>
			        </div>
					<div class="control">
			            <div class="title">收件人</div>
			            <form:input path="receiver" htmlEscape="false" cssClass="input normal"/>
			        </div>
					<div class="control">
			            <div class="title">联系电话</div>
			            <form:input path="recMobile" htmlEscape="false" cssClass="input normal"/>
			        </div>	
			        		        			        
			        			        			              		         
			    </div>   
			    <div class="group searchbtn">
			        <div class="btn-list">
			            <input type="submit" name="btnDetailedSearch" value="查询" id="btnDetailedSearch" class="btn">
			            <input name="btnReturn" type="reset" value="重置" class="btn yellow">
			        </div>
			    </div>
			    <div style="clear:both;"></div>
			</div>
		</form:form>
		<!--/搜索栏-->
		
		<!--列表-->
		<div class="table-container" >
			<table class="flexgrid" >
				<thead >
					<tr >
						<shiro:hasPermission name="sd:winner:edit">
							<th width="25">选择</th>
						</shiro:hasPermission>
						<th width="60">操作</th>
						<th width="40">编号</th>
						<th width="160">来源</th>
						<th width="130">奖品名称</th>
						<th width="100">抽奖时间</th>
						<th width="40">中奖</th>
<!-- 						<th width="40">领奖</th> -->
						<th width="90">派奖状况</th>
						<th width="200">微信openid</th>
						<th width="50">会员编号</th>
						<th width="85">会员昵称</th>
						<th width="85">微信昵称</th>
						<th width="80">手机号</th>
						<th width="85">收件人</th>
						<th width="80">联系方式</th>												
						<th width="200">收货地址</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${page.list}" var="winner">
					<tr>
						<td style="text-align:center;">
							<span class="checkall" style="vertical-align: middle;">
								<input type="checkbox" name="checkall" value="${winner.id}" />
							</span> 
						</td>
						<shiro:hasPermission name="sd:winner:edit">
							<td align="center">
								<a href="${ctx}/sd/winner/form?id=${winner.id}">修改</a>&nbsp;|&nbsp;
								<a href="${ctx}/sd/winner/delete?id=${winner.id}" onclick="return confirmx('确认要删除该中奖吗？', this.href)">删除</a>
							</td>
						</shiro:hasPermission>
						<td>${winner.id}</td>
						
						<c:choose>
						   <c:when test="${winner.source== 'biostime'}">  
								<td>积分抽奖(合生元)</td>
						   </c:when>
						   <c:when test="${winner.source== 'mama100'}">  
								<td>积分抽奖(妈妈100)</td>
						   </c:when>
						   <c:when test="${winner.source== 'share'}">  
								<td>分享抽奖(${winner.shareCode})</td>
						   </c:when>								   						   
						   <c:otherwise> 
							<td></td>  
						   </c:otherwise>
						</c:choose>	
													
						<c:choose>
						   <c:when test="${winner.awardname== '愤怒的小鸟套票'}">  
								<td>电影票(兑换码：${winner.movieCode})</td>
						   </c:when>
						   <c:otherwise> 
								<td>${winner.awardname}</td>
						   </c:otherwise>
						</c:choose>	
																		
						<td><fmt:formatDate value="${winner.createDate}" pattern="yyyy-MM-dd HH:mm"/></td>
						
						<c:choose>
						   <c:when test="${winner.isAward== 1}">  
							<td>是</td>  
						   </c:when>
						   <c:otherwise> 
							<td>否</td>  
						   </c:otherwise>
						</c:choose>	
						
<%-- 						<c:choose>
						   <c:when test="${winner.isPrized== 1}">  
							<td>是</td>  
						   </c:when>
						   <c:otherwise> 
							<td>否</td>  
						   </c:otherwise>
						</c:choose>	 --%>
						
						<c:choose>
						   <c:when test="${winner.is_overdue== 1}">  
								<td><p style="color:red">注册过期</p></td>	
						   </c:when>
						   <c:when test="${winner.is_overdue== 0}">  
								<td><p style="color:green">派奖成功</p></td>	
						   </c:when>
						   <c:when test="${winner.is_overdue== 2}">  
								<td><p style="color:blue">注册中</p></td>	
						   </c:when>						   
						</c:choose>	
												
						<td>${winner.openid}</td>
						<td>${winner.member.id}</td>												
						<td>${winner.member.nickname}</td>
						<td>${winner.wechatName}</td>
						<td>${winner.member.mobile}</td>
						<td>${winner.receiver}</td>
						<td>${winner.recMobile}</td>						
						<td>${winner.recAddr}</td>
					</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
		<!--/列表-->

		<!--内容底部-->
		<div class="line10"></div>
		<div class="pagelist">
			${page}
		</div>
		<!--/内容底部-->
	</body>
</html>
